Menu Selection
Volume Number: 2
Issue Number: 3
Column Tag: Inside Macintosh
Menu Selection for Desk Accessories
By Jan Eugenides, Assembly Corner, Maynard, MA
Writing Desk Accessories with Megamax C
Writing Desk Accessories is one of the more interesting (frustrating?)
programming tasks on the Macintosh. I have written a number of them using Megamax
C, and have found it to be an excellent system. There are some things they don't tell you
in the manual though, which I will point out. This article will present a complete
working desk accessory in Font/DA Mover format. It is modestly complex, and you can
use it as a shell for your own DA's.
The dCtlFlags
Each desk accessory has certain information about it stored in a “Device Control
Entry” (DCE) when it is opened. This includes such things as the driver's reference
number, a pointer to its window, the number of ticks between periodic actions, the
menu id, and the dCtlFlags.
Examine Listing #1. The first thing you see after the standard includes is the
letters"ACC" followed by some arcane numbers. This is a macro for setting the
dCtlFlags. The Megamax system makes it fairly simple to set up the flags properly,
with the ACC macro.
The first number, 0x6400, indicates that this driver needs to be locked (all DAs
do), will respond to control calls, and needs to perform periodic actions. The flags are
two bytes in length, but only the high order one is used. The bits of that byte are